package com.zjw.service.impl;

import com.zjw.dao.SubjectDao;
import com.zjw.dao.impl.SubjectDaoImpl;
import com.zjw.entity.Subject;
import com.zjw.service.SubjectService;
import com.zjw.utils.ConnectionUtil;

import java.sql.Connection;
import java.util.List;

/**
 * @projectName: studentCourseSelectionManagement
 * @package: com.zjw.service.impl
 * @className: SubjectServiceDao
 * @author: 翟
 * @date: 2025/4/7 0:17
 */

public class SubjectServiceImpl implements SubjectService {
    @Override
    public List<Subject> getSubjectListByGradeId(int gradeId) {
        Connection conn = ConnectionUtil.getConnection();
        List<Subject> r = null;
        try {
            SubjectDao subjectDao = new SubjectDaoImpl(conn);
            r =  subjectDao.selectSubjectByGradeId(gradeId);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            ConnectionUtil.closeALL(null , null , conn);
        }
        return r;
    }
}
